#pragma once

#include "Hazel/Core/Base.h"

// This ignores all warnings raised inside External headers
#pragma warning(push, 0)
#include <spdlog/spdlog.h>
#include <spdlog/fmt/ostr.h>
#include "spdlog/sinks/stdout_color_sinks.h"
#pragma warning(pop)

namespace Hazel
{
	class Log
	{
	public:
		static void Init();

		static Ref<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
		static Ref<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }

	private:
		static Ref<spdlog::logger> s_CoreLogger;
		static Ref<spdlog::logger> s_ClientLogger;
	};
}

#ifdef HZ_DEBUG
	// Core log macros
	#define HZ_CORE_TRACE(...)        ::Hazel::Log::GetCoreLogger()->trace(__VA_ARGS__)
	#define HZ_CORE_INFO(...)         ::Hazel::Log::GetCoreLogger()->info(__VA_ARGS__)
	#define HZ_CORE_WARN(...)         ::Hazel::Log::GetCoreLogger()->warn(__VA_ARGS__)
	#define HZ_CORE_ERROR(...)        ::Hazel::Log::GetCoreLogger()->error(__VA_ARGS__)
	#define HZ_CORE_CRITICAL(...)     ::Hazel::Log::GetCoreLogger()->critical(__VA_ARGS__)

	// Client log macros
	#define HZ_TRACE(...)             ::Hazel::Log::GetClientLogger()->trace(__VA_ARGS__)
	#define HZ_INFO(...)              ::Hazel::Log::GetClientLogger()->info(__VA_ARGS__)
	#define HZ_WARN(...)              ::Hazel::Log::GetClientLogger()->warn(__VA_ARGS__)
	#define HZ_ERROR(...)             ::Hazel::Log::GetClientLogger()->error(__VA_ARGS__)
	#define HZ_CRITICAL(...)          ::Hazel::Log::GetClientLogger()->critical(__VA_ARGS__)
#else
	#define HZ_CORE_TRACE(...)
	#define HZ_CORE_INFO(...)
	#define HZ_CORE_WARN(...)
	#define HZ_CORE_ERROR(...)
	#define HZ_CORE_CRITICAL(...)

	// Client log macros
	#define HZ_TRACE(...)
	#define HZ_INFO(...)
	#define HZ_WARN(...)
	#define HZ_ERROR(...)
	#define HZ_CRITICAL(...)
#endif
